package com.atguigu.mall.tripartite.config;


import lombok.Data;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;


/**
 * CloudStorageConfig
 * @description 云存储配置类
 */
@Data
@Configuration
public class CloudStorageConfig  implements InitializingBean {

    /**
     * 七牛域名domain
     */
    @Value("${oss.qiniu.domain}")
    private String qiniuDomain;
    /**
     * 七牛ACCESS_KEY
     */
    @Value("${oss.qiniu.accessKey}")
    private String qiniuAccessKey;
    /**
     * 七牛SECRET_KEY
     */
    @Value("${oss.qiniu.secretKey}")
    private String qiniuSecretKey;
    /**
     * 七牛空间名
     */
    @Value("${oss.qiniu.bucketName}")
    private String qiniuBucketName;


    public  static String  QINIU_DOMAIN;
    public  static String  QINIU_ACCESS_KEY;
    public  static String  QINIU_SECRET_KEY;
    public  static String  QINIU_BUCKET_NAME;

    @Override
    public void afterPropertiesSet() throws Exception {
        QINIU_DOMAIN = this.qiniuDomain;
        QINIU_ACCESS_KEY = this.qiniuAccessKey;
        QINIU_SECRET_KEY = this.qiniuSecretKey;
        QINIU_BUCKET_NAME = this.qiniuBucketName;
    }
}